<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>验证是否中奖</title>
    <script>
        window.onload= function(){
            var btn = document.getElementById("btn");
            btn.onclick = function(){
                var name = document.getElementById("name").value;
                if(name=="刘德华"){
                    alert("中奖了");
                    return;
                }
                alert("没中奖");
            }
        }
    </script>
</head>
<body>
<input type="text" name="name" value="请输入名称" id="name"><button id="btn">测试</button>
</body>
</html>